package com.forest.onlinechat.service.Impl;

import com.forest.onlinechat.mapper.FriendGroupsMapper;
import com.forest.onlinechat.pojo.FriendGroups;
import com.forest.onlinechat.service.FriendGroupsService;
import com.forest.onlinechat.utils.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class FriendGroupsServiceImpl implements FriendGroupsService {

    @Autowired
    private FriendGroupsMapper friendGroupsMapper;

    @Override
    public List<FriendGroups> getFriendGroups() {
        Map<String, Object> userInfo = ThreadLocalUtil.get();
        Integer userId = (Integer) userInfo.get("id");
        return friendGroupsMapper.getFriendGroups(userId);
    }
}
